<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <title>向专家提问</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f4f4f4;
        }
        .container {
            background: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 600px;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        input[type="text"], textarea, select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        textarea {
            height: 150px;
            resize: vertical;
        }
        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }
        button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>向专家提问</h2>
    <form action="${pageContext.request.contextPath}/expert/ask" method="post">
        <div class="form-group">
            <label for="title">问题标题</label>
            <input type="text" id="title" name="title" required>
        </div>
        <div class="form-group">
            <label for="content">问题描述</label>
            <textarea id="content" name="content" required></textarea>
        </div>
        <div class="form-group">
            <label for="expertId">选择专家</label>
            <select id="expertId" name="expertId" required>
                <c:forEach var="expert" items="${experts}">
                    <option value="${expert.id}">${expert.username}</option>
                </c:forEach>
            </select>
        </div>
        <div class="form-group">
            <label for="categoryId">选择分类（可选）</label>
            <select id="categoryId" name="categoryId">
                <option value="">-- 选择分类 --</option>
                <c:forEach var="category" items="${categories}">
                    <option value="${category.id}">${category.name}</option>
                </c:forEach>
            </select>
        </div>
        <button type="submit">提交问题</button>
    </form>
</div>
</body>
</html>